<?php

class Admin_Forms_Login extends Zend_Form {

    public function __construct($options = null) {
        parent::__construct($options);

        $this->addElement($this->username());
        $this->addElement($this->password());

        $_translate = Zend_Registry::get('Zend_Translate');
        $this->setTranslator($_translate);
    }

    /**
     * @desc init username textbox element
     * */
    protected function username() {
        $_username = new Zend_Form_Element_Text('username');
        $_username ->setRequired(true)
                  ->addValidator('NotEmpty');
        $_username->getValidator('NotEmpty')->setMessage('_LOGIN_USERNAME_REQUIRE_ERROR_MSG');
        return $_username;
    }

    /**
     * @desc init password element
     * */
    protected function password() {
        $_password = new Zend_Form_Element_Password('password');
        $_password ->setRequired(true)
                   ->addValidator('NotEmpty');
        $_password->getValidator('NotEmpty')->setMessage('_LOGIN_PASSWORD_REQUIRE_ERROR_MSG');
        return $_password;
    }

}